package net.lab1024.sa.admin.module.business.category.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import net.lab1024.sa.admin.module.business.category.domain.entity.RecordDetail;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface RecordDetailMapper extends BaseMapper<RecordDetail> {
    // 批量插入方法
    @Insert("<script>" +
            "INSERT INTO synthesis_record_detail " +
            "(record_id, step, description, reactants, products, reaction_smarts) " +
            "VALUES " +
            "<foreach collection='list' item='item' separator=','>" +
            "(#{item.recordId}, #{item.step}, #{item.description}, " +
            "#{item.reactants, typeHandler=net.lab1024.sa.admin.common.JsonTypeHandler}, " +
            "#{item.products, typeHandler=net.lab1024.sa.admin.common.JsonTypeHandler}, " +
            "#{item.reactionSmarts})" +
            "</foreach>" +
            "</script>")
    int insertBatch(List<RecordDetail> details);
}